FROM registry.cn-hangzhou.aliyuncs.com/udh/jdk:1.8.141

RUN useradd -m elasticsearch

RUN rm -rf /etc/yum.repos.d/* && wget http://10.110.117.99/downloads/repo/centos.repo && mv centos.repo /etc/yum.repos.d && yum clean all

RUN yum install -y expect

USER elasticsearch

WORKDIR /home/elasticsearch/

RUN wget http://10.110.117.99/downloads/elasticsearch/elasticsearch-6.8.23-linux-x86_64.tar.gz && tar -zxvf elasticsearch-6.8.23-linux-x86_64.tar.gz -C /home/elasticsearch/ \
    && rm -f elasticsearch-6.8.23-linux-x86_64.tar.gz && mv elasticsearch-6.8.23 elasticsearch && wget http://10.110.117.99/downloads/elasticsearch/elasticsearch_exporter-1.5.0.linux-amd64.tar.gz \
    && tar -zxvf elasticsearch_exporter-1.5.0.linux-amd64.tar.gz -C /home/elasticsearch/ && rm -f elasticsearch_exporter-1.5.0.linux-amd64.tar.gz && mv  elasticsearch_exporter-1.5.0.linux-amd64  elasticsearch_exporter

ENV ELASTICSEARCH_HOME=/home/elasticsearch/
ENV PATH=$PATH:$ELASTICSEARCH_HOME/elasticsearch/bin